package com.handu.luna.core.domain.order;

import com.handu.luna.core.domain.BasePersistentDomain;

import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Transient;

/**
 * Created by zhq on 2014/7/21.
 */

@Entity
public class OrderOperator  extends BasePersistentDomain<OrderOperatorRepository>{

    public enum OperatorType{
        CASCADE("关联操作"),MANMADE("人为操作");

        public String description;

        private OperatorType(String description){
            this.description = description;
        }
    }


    private long orderId;

    @Transient
    private OrderInfo orderInfo;

    private long operatorId;

    private String operatorName;

    private OperatorType operatorType;

    private boolean isParent;

    //操作之后的状态
    private OrderInfo.OrderStatus orderStatus;

    private OrderInfo.PaymentStatus paymentStatus;

    private OrderInfo.DeliveryStatus deliveryStatus;

    @Lob
    private String operatorMessage;
    @Lob
    private String closeReason;

    @Transient
    private String deliveryNumber;

    public String getDeliveryNumber() {
        return deliveryNumber;
    }

    public void setDeliveryNumber(String deliveryNumber) {
        this.deliveryNumber = deliveryNumber;
    }

    public boolean getIsParent(){
        return isParent;
    }

    public void setIsParent(boolean isParent){
        this.isParent = isParent;
    }

    public long getOrderId() {
        return orderId;
    }

    public void setOrderId(long orderId) {
        this.orderId = orderId;
    }

    public OrderInfo getOrderInfo() {
        return orderInfo;
    }

    public void setOrderInfo(OrderInfo orderInfo) {
        this.orderInfo = orderInfo;
    }

    public long getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(long operatorId) {
        this.operatorId = operatorId;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    public OrderInfo.OrderStatus getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(OrderInfo.OrderStatus orderStatus) {
        this.orderStatus = orderStatus;
    }

    public OrderInfo.PaymentStatus getPaymentStatus() {
        return paymentStatus;
    }

    public void setPaymentStatus(OrderInfo.PaymentStatus paymentStatus) {
        this.paymentStatus = paymentStatus;
    }

    public OrderInfo.DeliveryStatus getDeliveryStatus() {
        return deliveryStatus;
    }

    public void setDeliveryStatus(OrderInfo.DeliveryStatus deliveryStatus) {
        this.deliveryStatus = deliveryStatus;
    }

    public String getOperatorMessage() {
        return operatorMessage;
    }

    public void setOperatorMessage(String operatorMessage) {
        this.operatorMessage = operatorMessage;
    }

    public String getCloseReason() {
        return closeReason;
    }

    public void setCloseReason(String closeReason) {
        this.closeReason = closeReason;
    }

    public OperatorType getOperatorType() {
        return operatorType;
    }

    public void setOperatorType(OperatorType operatorType) {
        this.operatorType = operatorType;
    }

    public OrderOperator(long orderId, boolean isParent, String  orderStatus, String paymentStatus, String deliveryStatus) {
        this.orderId = orderId;
        this.isParent = isParent;
        this.orderStatus = OrderInfo.OrderStatus.valueOf(orderStatus);
        this.paymentStatus = OrderInfo.PaymentStatus.valueOf(paymentStatus);
        this.deliveryStatus = OrderInfo.DeliveryStatus.valueOf(deliveryStatus);
    }

    public OrderOperator(long orderId,  boolean isParent, OrderInfo.OrderStatus orderStatus, OrderInfo.PaymentStatus paymentStatus, OrderInfo.DeliveryStatus deliveryStatus) {
        this.orderId = orderId;
        this.operatorType = OperatorType.CASCADE;
        this.isParent = isParent;
        this.orderStatus = orderStatus;
        this.paymentStatus = paymentStatus;
        this.deliveryStatus = deliveryStatus;
    }

    public OrderOperator() {
        super();
    }
}
